﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AvantGameMachine.Graphics.Animators
{
    public class ChangePosVectorAnimator : RangeTimeAnimator
    {
        protected PosVector start = new PosVector(0.0f);
        protected PosVector end = new PosVector(0.0f);
        protected PosVector deltaVector;
        protected int propChange = -1;

        public ChangePosVectorAnimator()
        {
        }

        public override void Start()
        {
            base.Start();
            deltaVector = end - start;
        }

        public override bool OnAnimate()
        {
            bool result = base.OnAnimate();

            if (result)
            {
                animObject.SetProperty(propChange, start + (deltaVector * delta));
            }

            return result;
        }

        public PosVector StartValue
        {
            get { return start; }
            set { start = value; }
        }

        public PosVector EndValue
        {
            get { return end; }
            set { end = value; }
        }

        public int PropertyToChange
        {
            get { return propChange; }
            set { propChange = value; }
        }
    }
}
